<!--审批模板-->
<template>
  <div class="approveComment">
    <!--头部bar开始-->
    <CommonBar :options="options"></CommonBar>
    <!--头部bar结束-->
    <div class="content">
      <van-field v-model="comment" placeholder="请发表评论" type="textarea" autosize rows="8" />
    </div>
    <div class="butbottom butbottom1">
      <button class="subbut" @click="submitdata">评论</button>
    </div>
  </div>
</template>
<script>
import { mapState } from "vuex";
import CommonBar from "../common/commonBar";
export default {
  components: {
    CommonBar
  },
  computed: {
    ...mapState({
      token: state => state.Authorization
    })
  },
  data() {
    return {
      nochekData: require("../../../static/image/nochekData.png"),
      temimg: require("../../../static/image/applytem.png"),
      options: {
        type: "icon",
        centerText: "评论",
        iconNname: "wap-home",
        lefttype: "left"
      },
      comment: "",
      status: "",
      leave_id: ""
    };
  },
  created() {
    this.leave_id = this.$route.query.leave_id;
    this.status = this.$route.query.status;
  },

  methods: {
    submitdata(params) {
      var params = {
        token: this.token,
        leave_id: this.leave_id,
        status: this.status,
        comment: this.comment
      };
      this.$http
        .post(`${this.$basePath}?service=App.Leave.CheckLeave&api=89`, params)
        .then(res => {
          if (res.ret == 200) {
            //console.log("审核", res);
            this.$router.push({
              //核心语句
              path: "/approveIndex" //跳转的路径
            });
          } else {
            this.$toast({ message: res.msg });
          }
        });
    }
  }
};
</script>
<style lang="less" scoped>
.approveComment {
  width: 100%;
  height: 100%;
}
.content {
  width: 100%;
  height: 100%;

  margin-bottom: 40px;
}
.van-cell {
  width: 92%;
  margin: 15px auto 0;
  background: #e6e6e6;
}

.butbottom {
  width: 100%;
  padding: 10px 0;
  position: fixed;
  bottom: 0;

  .subbut {
    width: 92%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    background: rgba(10, 213, 145, 1);
    border-radius: 5px;
    margin: 0 auto;
    outline: none;
    border: none;
  }
}
</style>